package com.fdm.model.properties;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class SQLProperties 
{
	private final Properties properties = new Properties();
	private final String URL;
	private final String userName;
	private final String password;
	private final String driver;
	private final String select;
	private final String delete;
	private final String update;
	private final String insert;
	private final String selectAll;
	private final String max;
	
	public SQLProperties()
	{
		ReadFile("BankTeller.properties");
		this.URL = properties.getProperty("URL");
		this.userName = properties.getProperty("USER_NAME");
		this.password = properties.getProperty("PASSWORD");
		this.driver = properties.getProperty("DRIVER");
		this.select = properties.getProperty("SELECT");
		this.delete = properties.getProperty("DELETE");
		this.update = properties.getProperty("UPDATE");
		this.insert = properties.getProperty("INSERT");
		this.selectAll = properties.getProperty("SELECT_ALL");
		this.max = properties.getProperty("MAX");
	}
	public String getMax(){
		return max;
	}
	public Properties getProperties() {
		return properties;
	}

	public String getURL() {
		return URL;
	}

	public String getUserName() {
		return userName;
	}

	public String getPassword() {
		return password;
	}

	public String getDriver() {
		return driver;
	}

	public String getSelect() {
		return select;
	}

	public String getDelete() {
		return delete;
	}

	public String getUpdate() {
		return update;
	}

	public String getInsert() {
		return insert;
	}

	public String getSelectAll() {
		return selectAll;
	}

	private void ReadFile(String file)
	{
		try {
			InputStream inputStream = this.getClass().getClassLoader()  
	        .getResourceAsStream(file); 
			properties.load(inputStream);
		} catch (FileNotFoundException e) {

		} catch (IOException e) {

		}
	}
}
